﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Quadratic equation</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <div id="js-console"></div>
	<script src="scripts/js-console.js"></script>
    
    <script>
        var a = 1;
        var b = 2
        var c = -3;
        var discriminant = (b * b) - 4 * a * c;
        var firstRoot=0;
        var secondRoot=0;

        if (discriminant>0) {
            firstRoot = (-b + (Math.sqrt(discriminant))) / 2 * a;
            secondRoot = (-b - (Math.sqrt(discriminant))) / 2 * a;
        }
        else if (discriminant==0) {
            firstRoot=secondRoot=(-b/2*a);
        }
        else {
            jsConsole.writeLine("Wrong coefficients! The discriminant cannot be a negative number!");
        }
        jsConsole.writeLine(firstRoot);
        jsConsole.writeLine(secondRoot);
    </script>
</body>
</html>
